# eric7.Project.ProjectFormsBrowser

Module implementing a class used to display the forms part of the project.

### Global Attributes

None

### Classes

ProjectFormsBrowser | A class used to display the forms part of the project.

### Functions

None

## ProjectFormsBrowser

A class used to display the forms part of the project.

### Signals

appendStderr(str)
  emitted after something was received from a QProcess on stderr
menusAboutToBeCreated()
  emitted when the context menus are about to be created. This is the right moment to add or remove hook methods.
showMenu(str, QMenu)
  emitted when a menu is about to be shown. The name of the menu and a reference to the menu are given.
uipreview(str)
  emitted to preview a forms file

### Derived from

ProjectBaseBrowser

### Class Attributes

Pyuic5IndentDefault
Pyuic6IndentDefault

### Class Methods

None

### Methods

ProjectFormsBrowser | Constructor
__TRPreview | Private slot to handle the Preview translations action.
__UIPreview | Private slot to handle the Preview menu action.
__addFormFiles | Private method to add form files to the project.
__addFormsDirectory | Private method to add form files of a directory to the project.
__compileAllForms | Private method to compile all forms to source files.
__compileChangedForms | Private method to compile all changed forms to source files.
__compileForm | Private method to compile a form to a source file.
__compileSelectedForms | Private method to compile selected forms to source files.
__compileUI | Private method to compile a .ui file to a .py/.rb file.
__compileUIDone | Private slot to handle the finished signal of the pyuic/rbuic process.
__configureUicCompiler | Private slot to configure some non-common uic compiler options.
__deleteFile | Private method to delete a form file from the project.
__determineUiCompiler | Private method to determine the UI compiler for the project.
__generateDialogCode | Private method to generate dialog code for the form (Qt only).
__newForm | Private slot to handle the New Form menu action.
__newUiForm | Private slot to handle the New Form menu action for Qt-related projects.
__openFile | Private slot to handle the Open menu action.
__openFileInEditor | Private slot to handle the Open in Editor menu action.
__readStderr | Private slot to handle the readyReadStandardError signal of the pyuic5/pyuic6/pyside6-uic process.
__readStdout | Private slot to handle the readyReadStandardOutput signal of the pyuic5/pyuic6/pyside6-uic process.
__resetUiCompiler | Private slot to reset the determined UI compiler executable.
__showContextMenu | Private slot called by the menu aboutToShow signal.
__showContextMenuBack | Private slot called by the backMenu aboutToShow signal.
__showContextMenuDir | Private slot called by the dirMenu aboutToShow signal.
__showContextMenuDirMulti | Private slot called by the dirMultiMenu aboutToShow signal.
__showContextMenuMulti | Private slot called by the multiMenu aboutToShow signal.
_contextMenuRequested | Protected slot to show the context menu.
_createPopupMenus | Protected overloaded method to generate the popup menu.
_initHookMethods | Protected method to initialize the hooks dictionary.
_openItem | Protected slot to handle the open popup menu entry.
getIcon | Public method to get an icon for the project browser.
getUiCompiler | Public method to get the UI compiler executable of the project.
handlePreferencesChanged | Public slot used to handle the preferencesChanged signal.

### Static Methods

None

#### ProjectFormsBrowser (Constructor)

ProjectFormsBrowser(project, projectBrowser, parent=None)

Constructor

project (Project)
  reference to the project object
projectBrowser (ProjectBrowser)
  reference to the project browser object
parent (QWidget)
  parent widget of this browser

#### ProjectFormsBrowser.__TRPreview

__TRPreview()

Private slot to handle the Preview translations action.

#### ProjectFormsBrowser.__UIPreview

__UIPreview()

Private slot to handle the Preview menu action.

#### ProjectFormsBrowser.__addFormFiles

__addFormFiles()

Private method to add form files to the project.

#### ProjectFormsBrowser.__addFormsDirectory

__addFormsDirectory()

Private method to add form files of a directory to the project.

#### ProjectFormsBrowser.__compileAllForms

__compileAllForms()

Private method to compile all forms to source files.

#### ProjectFormsBrowser.__compileChangedForms

__compileChangedForms()

Private method to compile all changed forms to source files.

#### ProjectFormsBrowser.__compileForm

__compileForm()

Private method to compile a form to a source file.

#### ProjectFormsBrowser.__compileSelectedForms

__compileSelectedForms()

Private method to compile selected forms to source files.

#### ProjectFormsBrowser.__compileUI

__compileUI(fn, noDialog=False, progress=None)

Private method to compile a .ui file to a .py/.rb file.

fn (str)
  filename of the .ui file to be compiled
noDialog (bool)
  flag indicating silent operations
progress (QProgressDialog)
  reference to the progress dialog

Return:
  reference to the compile process

Return Type:
  QProcess

#### ProjectFormsBrowser.__compileUIDone

__compileUIDone(exitCode, exitStatus)

Private slot to handle the finished signal of the pyuic/rbuic process.

exitCode (int)
  exit code of the process
exitStatus (QProcess.ExitStatus)
  exit status of the process

#### ProjectFormsBrowser.__configureUicCompiler

__configureUicCompiler()

Private slot to configure some non-common uic compiler options.

#### ProjectFormsBrowser.__deleteFile

__deleteFile()

Private method to delete a form file from the project.

#### ProjectFormsBrowser.__determineUiCompiler

__determineUiCompiler()

Private method to determine the UI compiler for the project.

#### ProjectFormsBrowser.__generateDialogCode

__generateDialogCode()

Private method to generate dialog code for the form (Qt only).

#### ProjectFormsBrowser.__newForm

__newForm()

Private slot to handle the New Form menu action.

#### ProjectFormsBrowser.__newUiForm

__newUiForm(path)

Private slot to handle the New Form menu action for Qt-related projects.

path (str)
  full directory path for the new form file

#### ProjectFormsBrowser.__openFile

__openFile()

Private slot to handle the Open menu action.

#### ProjectFormsBrowser.__openFileInEditor

__openFileInEditor()

Private slot to handle the Open in Editor menu action.

#### ProjectFormsBrowser.__readStderr

__readStderr()

Private slot to handle the readyReadStandardError signal of the pyuic5/pyuic6/pyside6-uic process.

#### ProjectFormsBrowser.__readStdout

__readStdout()

Private slot to handle the readyReadStandardOutput signal of the pyuic5/pyuic6/pyside6-uic process.

#### ProjectFormsBrowser.__resetUiCompiler

__resetUiCompiler()

Private slot to reset the determined UI compiler executable.

#### ProjectFormsBrowser.__showContextMenu

__showContextMenu()

Private slot called by the menu aboutToShow signal.

#### ProjectFormsBrowser.__showContextMenuBack

__showContextMenuBack()

Private slot called by the backMenu aboutToShow signal.

#### ProjectFormsBrowser.__showContextMenuDir

__showContextMenuDir()

Private slot called by the dirMenu aboutToShow signal.

#### ProjectFormsBrowser.__showContextMenuDirMulti

__showContextMenuDirMulti()

Private slot called by the dirMultiMenu aboutToShow signal.

#### ProjectFormsBrowser.__showContextMenuMulti

__showContextMenuMulti()

Private slot called by the multiMenu aboutToShow signal.

#### ProjectFormsBrowser._contextMenuRequested

_contextMenuRequested(coord)

Protected slot to show the context menu.

coord (QPoint)
  the position of the mouse pointer

#### ProjectFormsBrowser._createPopupMenus

_createPopupMenus()

Protected overloaded method to generate the popup menu.

#### ProjectFormsBrowser._initHookMethods

_initHookMethods()

Protected method to initialize the hooks dictionary.

Supported hook methods are:

- compileForm: takes filename as parameter
- compileAllForms: takes list of filenames as parameter
- compileSelectedForms: takes list of filenames as parameter
- compileChangedForms: takes list of filenames as parameter
- generateDialogCode: takes filename as parameter
- newForm: takes full directory path of new file as parameter
- open: takes a filename as parameter

Note: Filenames are relative to the project directory, if not specified differently.

#### ProjectFormsBrowser._openItem

_openItem()

Protected slot to handle the open popup menu entry.

#### ProjectFormsBrowser.getIcon

getIcon()

Public method to get an icon for the project browser.

Return:
  icon for the browser

Return Type:
  QIcon

#### ProjectFormsBrowser.getUiCompiler

getUiCompiler()

Public method to get the UI compiler executable of the project.

Return:
  UI compiler executable

Return Type:
  str

#### ProjectFormsBrowser.handlePreferencesChanged

handlePreferencesChanged()

Public slot used to handle the preferencesChanged signal.

Up